<#import "/ftl/mainAdmin.ftl" as page>

<@page.mainTemplate styleSheet="rolemanageCss" jsFile="rolemanageJs" current="角色管理">
  	<div class="page-content">
        <!-- BEGIN PAGE HEAD-->
        <div class="page-head">
            <!-- BEGIN PAGE TITLE -->
                <div class="page-title">
                    <h1>角色管理
                        <small>分配权限</small>
                    </h1>
                </div>
            <!-- END PAGE TITLE -->
        </div>
        <!-- END PAGE HEAD -->
        <!-- BEGIN PAGE BREADCRUMB -->
        <ul class="page-breadcrumb breadcrumb">
            <li>
	            <a href="${context}/base/index_ftl">首页</a>
	            <i class="fa fa-circle"></i>
	        </li>
            <li>
                <span class="active">分配权限</span>
            </li>
        </ul>
        <!-- END PAGE BREADCRUMB -->
        <!-- BEGIN PAGE BASE CONTENT -->
        
        <div class="row">
            <div class="col-md-12 col-sm-12">
                <!-- BEGIN PORTLET-->
                <div class="portlet light form-fit bordered">
                    <div class="portlet-body form">
                                        <!-- BEGIN FORM-->
                                        <form action="#" class="form-horizontal form-bordered" id="powerForm" style="">
                                        <input type="hidden" id="roleId" name="roleId" value="${role.id}">
                                            <div class="form-body">
                                                <div class="form-group" style="background: #F5F5F5;">
                                                     <div class="col-md-2" style="border-top: 0;">
                                                         <div class="mt-checkbox-inline">
                                                            <label class="mt-checkbox" style="margin-bottom: 0px;">
                                                            	  一级菜单
                                                            </label>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-2" style="border-top: 0;">
                                                         <div class="mt-checkbox-inline">
                                                            <label class="mt-checkbox" style="margin-bottom: 0px;">
                                                            	  二级菜单
                                                            </label>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-8" style="border-top: 0;">
                                                        	按钮权限
                                                    </div>
                                                </div>
                                             <#if functionList ??>
                                                 <#list functionList as function>
                                                   <#if (function.nodeNum>0)>
												<div class="col-md-2" style="border-top:2px solid #ddd;">
													<div class="mt-checkbox-inline" title="${function.remark}">
														<label class="mt-checkbox" style="">
															<input type="checkbox" <#if function.check_status==1  >checked</#if> name="function_ids" value="${function.id}">${function.function_name}
														<span></span>
														</label>
													</div>
												</div>
	                                                  <div class="form-group" style="border-bottom:none;">
	                                                     <div class="col-md-2" style="height:100%;border-top:2px solid #ddd;">
	                                                         <div class="mt-checkbox-inline">
	                                                            <label class="mt-checkbox">
	                                                                <span></span>
	                                                            </label>
	                                                        </div>
	                                                      </div>
	                                                       <div class="col-md-8" style="border-top:2px solid #ddd;">
	                                                        <div class="mt-checkbox-inline">
		                                                      <#list function.detailList as buttonVO >
			                                                            <label class="mt-checkbox" title="${buttonVO.remark}">
			                                                                <input type="checkbox" <#if buttonVO.check_status==1  >checked</#if> name="function_button_ids" value="${buttonVO.id_str}"> ${buttonVO.button_name}
			                                                                <span></span>
			                                                            </label>
			                                                    </#list>
			                                                   </div>
		                                                     </div>
                                                	</div>
                                                	 <#list functionList as function2>
	                                                	 <#if function2.pid==function.id>
											          <div class="col-md-2"></div>
		                                                  <div class="form-group" style="border-bottom:none;">
															  <!--<div class="col-md-2">
																  <div class="mt-checkbox-inline">
																	  <span></span>
																  </div>
															  </div>-->

		                                                      <div class="col-md-2" style="height: 100%;">
		                                                         <div class="mt-checkbox-inline" title="${function.remark}">
		                                                           <label class="mt-checkbox">
		                                                                <input type="checkbox" <#if function2.check_status==1  >checked</#if> name="function_ids" value="${function2.id}">${function2.function_name}
		                                                                <span></span>
		                                                            </label>
		                                                        </div>
		                                                      </div>
		                                                       <div class="col-md-8">
		                                                        <div class="mt-checkbox-inline">
			                                                      <#list function2.detailList as buttonVO >
				                                                            <label class="mt-checkbox" title="${buttonVO.remark}">
				                                                                <input type="checkbox" <#if buttonVO.check_status==1  >checked</#if> name="function_button_ids" value="${buttonVO.id_str}"> ${buttonVO.button_name}
				                                                                <span></span>
				                                                            </label>
				                                                    </#list>
				                                                   </div>
			                                                     </div>
	                                                		</div>
	                                                		</#if>
                                                		</#list>
                                                	</#if>
                                                	
									             </#list>
									             </#if>

                                            </div>
                                            <div class="form-group" style="border-top: 1px solid #ddd;">
                                            	<!--<label class="control-label col-md-3"></label>-->
                                            	<div class="col-md-12" style="text-align: center;">
                                            		<button type="submit" class="btn green">保存</button>&nbsp;&nbsp;&nbsp;
                                            		<a type="button" class="btn default" href="${context}/role/roleIndex">返回</a>
                                            	</div>
                                            </div>
                                        </form>
<style>
	#powerForm.form-bordered .form-group > div{
		border-bottom: none !important;
		border-top: 1px solid #ddd;
		border-right: 1px solid #efefef;
	}
	#powerForm.form-bordered .form-group > div label{
		margin-bottom: 0px;
	}
	#powerForm.form-bordered .form-group > div{
		border-bottom: 1px solid #efefef;
	}
	.form .form-bordered .form-group > div.col-md-8{
		border-left: none !important;
		border-right: none !important;
	}
	#powerForm > div > div > div > label{
		position: relative;
		top:1.2rem;
	}
</style>
                     </div>
                </div>
                <!-- END PORTLET-->
            </div>
        </div>
        <!-- END PAGE BASE CONTENT -->
    </div>
</@page.mainTemplate>
<script>
	$(function(){
	    /*$("#powerForm > div > div:nth-child(2) > div > label").css("line-height","100px");*/
	   /* if($("#powerForm.form-bordered .form-group > div span").html() == ""){
            //$("#powerForm.form-bordered .form-group > div span").css("border-top","none");
			alert(1111);
		}*/
	})
</script>